/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.pay.service.upop;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.pay.entity.upop.EcOrgUpop;
import com.thinkgem.jeesite.modules.config.dao.pay.ConfigPayManageDao;
import com.thinkgem.jeesite.modules.pay.dao.upop.EcOrgUpopDao;

/**
 * 银联Service
 * @author Egan
 * @version 2016-12-26
 */
@Service
@Transactional(readOnly = true)
public class EcOrgUpopService extends CrudService<EcOrgUpopDao, EcOrgUpop> {
	@Autowired
	EcOrgUpopDao ecOrgUpopDao;
	@Autowired
	ConfigPayManageDao configPayManageDao;
	public EcOrgUpop get(String id) {
		return super.get(id);
	}
	
	public List<EcOrgUpop> findList(EcOrgUpop ecOrgUpop) {
		return super.findList(ecOrgUpop);
	}
	
	public Page<EcOrgUpop> findPage(Page<EcOrgUpop> page, EcOrgUpop ecOrgUpop) {
		return super.findPage(page, ecOrgUpop);
	}
	
	@Transactional(readOnly = false)
	public void save(EcOrgUpop ecOrgUpop) {
		super.save(ecOrgUpop);
	}
	
	@Transactional(readOnly = false)
	public void delete(EcOrgUpop ecOrgUpop) {
		super.delete(ecOrgUpop);
	}
	public EcOrgUpop getUpopByMerchantNo(String merchantId) {
		return ecOrgUpopDao.getUpopByMerchantNo(merchantId);
	}
	
	@Transactional(readOnly = false)
	public void insertUPOP(EcOrgUpop ecOrgUpop) {
		
		ecOrgUpopDao.insertUpop(ecOrgUpop);
		ecOrgUpop.getConfigPayManage().setConfigPayId(ecOrgUpop.getId());
		ecOrgUpop.getConfigPayManage().setId(ecOrgUpop.getId());
		configPayManageDao.insert(ecOrgUpop.getConfigPayManage());
	}
}